import { TweenPlugin } from "./TweenPlugin";
import { TweenLite } from "../TweenLite";
//class HexColorsPlugin
    
    export  class HexColorsPlugin extends TweenPlugin
    {
        constructor()
        {
            
            super();this.propName = "hexColors";
            this.overwriteProps = [];
            this._colors = [];
            return;
        }

        public /* override */ onInitTween(arg1: Object, arg2, arg3: TweenLite): Boolean
        {
            var loc1=null;
            var loc2=0;
            var loc3=arg2;
            for (loc1 in loc3) 
            {
                this.initColor(arg1, loc1, uint(arg1[loc1]), uint(arg2[loc1]));
            }
            return true;
        }

        public initColor(arg1: Object, arg2: string, arg3: uint, arg4: uint): void
        {
            var loc1=NaN;
            var loc2=NaN;
            var loc3=NaN;
            if (arg3 != arg4) 
            {
                loc1 = arg3 >> 16;
                loc2 = arg3 >> 8 & 255;
                loc3 = arg3 & 255;
                this._colors[this._colors.length] = [arg1, arg2, loc1, (arg4 >> 16) - loc1, loc2, (arg4 >> 8 & 255) - loc2, loc3, (arg4 & 255) - loc3];
                this.overwriteProps[this.overwriteProps.length] = arg2;
            }
            return;
        }

        public /* override */ killProps(arg1: Object): void
        {
            var loc1=(this._colors.length - 1);
            while (loc1 > -1) 
            {
                if (arg1[this._colors[loc1][1]] != undefined) 
                {
                    this._colors.splice(loc1, 1);
                }
                --loc1;
            }
            super.killProps(arg1);
            return;
        }

        public /* override */ set changeFactor(arg1: number)
        {
            var loc1=0;
            var loc2=null;
            loc1 = (this._colors.length - 1);
            while (loc1 > -1) 
            {
                loc2 = this._colors[loc1];
                loc2[0][loc2[1]] = loc2[2] + arg1 * loc2[3] << 16 | loc2[4] + arg1 * loc2[5] << 8 | loc2[6] + arg1 * loc2[7];
                --loc1;
            }
            return;
        }

        public static /* const */API: number=1;

        protected /* var */_colors: Array<any>;
    }
